package com.ec.kafka.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;

/**
 * kafka 消费类
 *
 * @author gourd
 */
@Slf4j
public class KafkaConsumerListener {

    @KafkaListener(topics = "${spring.kafka.consumer.ec-topic:ec-topic}",
            groupId = "${spring.kafka.consumer.group-id:ec-group}",
            containerFactory = "kafkaListenerContainerFactory")
    public void kafkaReceive(ConsumerRecord<String, String> record) {
        log.info("消消费消息 topic = {} , message = {}", record.topic(), record.value());
    }

}
